##=============================================================================
## Main Manuscript: Table 1
##=============================================================================

##-----------------
# clear environment
rm(list=ls())
options(stringsAsFactors = FALSE, scipen = 999)
# source("R/functions.R")

##--------
# Set seed
seed <- sample.int(.Machine$integer.max, 1)
set.seed(seed)

##-------------
# Load Packages
ipak <- function(pkg){new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if(length(new.pkg)) install.packages(new.pkg, dependencies = TRUE)
sapply(pkg, require, character.only = TRUE)
}

packages <- c("tidyverse")

ipak(packages)

##---------
# Load data
#setwd("/Users/austinknuppe/Library/CloudStorage/Dropbox/Ukraine2022WartimeSurvey/Paper_peace/final_version_oct_2024/replication-scripts")
load("clean_ukraine_data.RData")

##-----------------------------------------
# Descriptive Stats for Dependent Variables
dat %>% 
  dplyr::select(wave, save_lives, compromise, compromise_idx_full,
                ukr_no_nato, rus_lang_schools) %>% 
  group_by(wave) %>% 
  summarise(across(everything(), list(mean = mean, sd = sd), na.rm = TRUE)) %>% 
  pivot_longer(cols = -wave, names_to = "variable", values_to = "stat")

dat %>% 
  dplyr::select(wave, save_lives, compromise, compromise_idx_full,
                ukr_no_nato, rus_lang_schools) %>% 
  group_by(wave) %>% 
  summarise_all(~ sum(is.na(.))) %>% 
  pivot_longer(cols = -wave, names_to = "variable", values_to = "missing")

rm(list = ls())
##=============================================================================
## End of File
##=============================================================================